package com.vvv.shortlink.project.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vvv.shortlink.project.dao.entity.LinkAccessLogsDO;
import com.vvv.shortlink.project.dto.req.LinkStatsReqDTO;
import com.vvv.shortlink.project.dto.resp.LinkStatsTopIpRespDTO;
import com.vvv.shortlink.project.dto.resp.LinkStatsUvRespDTO;
import com.vvv.shortlink.project.dto.req.SelectUvTypeDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author Dell
* @description 针对表【t_link_access_logs】的数据库操作Mapper
* @createDate 2024-02-21 15:40:48
* @Entity com.vvv.shortlink.project.dao.entity.LinkAccessLogsDO
*/
public interface LinkAccessLogsMapper extends BaseMapper<LinkAccessLogsDO> {

    /**
     * 以ip分组，获取范围时间内每个ip的总条数count(ip)
     *
     * @param requestParam
     * @return
     */
    List<LinkStatsTopIpRespDTO> listTopIpStatsGroupByIp(@Param("requestParam") LinkStatsReqDTO requestParam);

    /**
     * 获取在范围时间内新老客户的总访问量
     *
     * @param requestParam
     * @return
     */
    List<LinkStatsUvRespDTO> listOldAndNewUserStats(@Param("requestParam") LinkStatsReqDTO requestParam);

    /**
     * 获取指定用户是否为新访客还是老访客
     *
     * @param userId
     * @param fullShortUrl
     * @param startDate
     * @param endDate
     * @param uvList
     * @return 新老访客列表
     */
    List<SelectUvTypeDTO> selectUvTypeByUsers(
            @Param("userId") Long userId,
            @Param("fullShortUrl") String fullShortUrl,
            @Param("startDate") String startDate,
            @Param("endDate") String endDate,
            @Param("uvList") List<String> uvList
    );
}




